package uicontrols 
{
	import flash.display.Bitmap;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.text.TextField;
	import img.ChekPlane;
	import ru.gosoplata.model.TmpModel;
	/**
	 * ...
	 * @author aorlean
	 */
	public class ButtonSelectService extends Sprite 
	{
		private var chplane:ChekPlane;
		private var info_txt:String;
		private var txt:TextField;
		
		public function ButtonSelectService() 
		{
			//super("checkableplane");
			addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		public function isChecked():Boolean {
			return chplane.swChek;
		}
		
		public function swCheck(val:Boolean):void {
			chplane.swChek = val;
		}
		
		private function init(e:Event):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);
			
			var fon:Bitmap = new Bitmap(TmpModel.loadedImages.getBitmapDataByName("checkableplane").bitmapData);
			fon.x = 0;
			fon.y = 0;
//			fon.scaleY = 0.5;
//			fon.scaleX = 1.1;
			addChild(fon);
			chplane = new ChekPlane();
			chplane.x = 10;
			chplane.y = 10;
			chplane.scaleX = 0.7;
			chplane.scaleY = 0.7;
			addChild(chplane);
			txt = new TextField();
			txt.x = 80;
			txt.y = chplane.y;
			txt.width = 350;
			txt.height = 90;
			txt.defaultTextFormat = TmpModel.getTextFormat(18, 0xFFFFFF);
			txt.embedFonts = true;
			txt.multiline = true;
			txt.selectable = false;
			txt.wordWrap = true;
			addChild(txt);
		}
		
		public function get info():String 
		{
			return info_txt;
		}
		
		public function set info(value:String):void 
		{
			info_txt = value;
			txt.text = info_txt;
		}
	}

}